@extends('admin.layout')
@section('content')
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" >
            <div class="col-md-12" id="content" >
                <div class="app_content_div" id="app_content_div_301Index">
                    <h3>专家列表</h3>
                </div>
                <div style="float:right;"><button type="button" class="btn btn-primary" onclick="window.location.href='/adm/expert/add'">新增专家</button></div>

                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th>id</th>
                        <th>姓名</th>
                        <th>职称</th>
                        <th>科室</th>
                        <th>医院</th>
                        <th>简介</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($experts as $v)
                        <tr>
                            <td>{{$v->id}}</td>
                            <td>{{$v->name}}</td>
                            <td>{{$v->ks}}</td>
                            <td>{{$v->zc}}</td>
                            <td>{{$v->hos}}</td>
                            <td>{{$v->intro}}</td>
                            <td>
                                <a href="/adm/expert/edit/{{$v->id}}"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></a> &nbsp;&nbsp;&nbsp;
                                <a onclick="del({{$v->id}});"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
                                </form>
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
            {{$experts->links('front.paginate')}}
            </div>
        </div>
        <script>
            function del(id){
                var conf = confirm('你确定要删除这条记录吗？');
                if(conf==true){
                    $.ajax({
                        url:'/adm/expert/destroy/'+id,
                        type:'DELETE',
                        dataType:'json',
                        data:{'_token':'{{csrf_token()}}'},
                        success:function (data){
                            alert('删除成功');
                            location.href='/adm/expert';
                        },
                        error:function (data){}
                    });
                }}
        </script>
@endsection

